//
//  NoteTViewCell.m
//  Travel assistant
//
//  Created by lanou3g on 16/2/27.
//  Copyright © 2016年 旅游助手. All rights reserved.
//

#import "NoteTViewCell.h"

@implementation NoteTViewCell
static NSString *const noteMinTopCell = @"NoteMinTopCell";
static NSString *const noteMinMidCell = @"NoteMinMidCell";
static NSString *const noteMinOtherCell = @"NoteMinOtherCell";


- (void)awakeFromNib {
    // Initialization code
    [self setDelegate];
    [self setRegisterCell];
    /**设置TableView attribute*/
    [self setTableViewAttributes];
}
/**设置代理*/
- (void)setDelegate{
    self.cellMinTableview.delegate = self;
    self.cellMinTableview.dataSource = self;
}
/**注册tableViewCell*/
- (void)setRegisterCell{
    [self.cellMinTableview registerNib:[UINib nibWithNibName:@"NoteMinTopCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:noteMinTopCell];
    [self.cellMinTableview registerNib:[UINib nibWithNibName:@"NoteMinMidCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:noteMinMidCell];
    [self.cellMinTableview registerNib:[UINib nibWithNibName:@"NoteMinOtherCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:noteMinOtherCell];
}
- (void)setTableViewAttributes{
#pragma mark ------??????-----
    NoteMinOtherCell *cell;
    [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
    /**禁止ScrollerView上下滚动*/
    self.cellMinTableview.scrollEnabled = NO;
}
/**懒加载*/
- (NSArray *)journeyArrList{
    if (!_journeyArrList) {
        _journeyArrList = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"JourneyList" ofType:@"plist"]];
    }
    return _journeyArrList;
}
#pragma mark ---以下是与TableView有关的代理方法---
- (NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 7;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        NoteMinTopCell *cell = [tableView dequeueReusableCellWithIdentifier:noteMinTopCell forIndexPath:indexPath];
        cell.weatherButtonBlock = ^(){
            NSLog(@"---------weatherButtonBlock------");
        };
        return cell;
    }
    if (indexPath.row == 1) {
        NoteMinMidCell *cell = [tableView dequeueReusableCellWithIdentifier:noteMinMidCell forIndexPath:indexPath];
        return cell;
    }
    
    NoteMinOtherCell *cell = [tableView dequeueReusableCellWithIdentifier:noteMinOtherCell forIndexPath:indexPath];
    cell.detailLable.text = self.journeyArrList[indexPath.row - 2];
    return cell;
}
- (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 35;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (self.noteTViewCellBlock) {
        self.noteTViewCellBlock(indexPath);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
